package com.workerthread;

import lombok.extern.slf4j.Slf4j;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;

/**
 * @author 罗俊华
 * @date 2021/8/24 - 3:21 下午
 */
@Slf4j
public class Client {

    public static void main(String[] args) {
        try (SocketChannel socketChannel = SocketChannel.open(new InetSocketAddress(5689))) {

            socketChannel.write(StandardCharsets.UTF_8.encode("hello\nworld\n"));

            log.debug("数据已发送");

        } catch (IOException e) {

            e.printStackTrace();
        }
    }
}
